﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Core;

namespace DataAccess.Classes
{
  public  class Email
  {
      public int IDEmail { get; set; }
      public string DuoiEmail { get; set; }

      public Email() { }

      public static bool Them(Email email)
      {
          try
          {
              object rs = DataProvider.Instance.ExecuteNonQueryWithOutput("IDEmail", "Email_Add", email.IDEmail, email.DuoiEmail);
              return Convert.ToInt32(rs) > 0;
          }
          catch
          {
              return false;
          }
      }
      public static List<Email> LayDanhSach()
      {
          try
          {
              return CBO.FillCollection<Email>(DataProvider.Instance.ExecuteReader("Email_All"));
          }
          catch
          {
              return null;
          }
      }
      public static bool Xoa(int id)
      {
          try
          {
              int rs = DataProvider.Instance.ExecuteNonQuery("Email_Xoa", id);
              return rs > 0;
          }
          catch
          {
              return false;
          }
      }
  }
}
